home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Freeware / Gobby 0.4.7 / gobby-0.4.7.exe / {app} / share / gtksourceview-2.0 / language-specs / lua.lang < prev    next >
Extensible Markup Language  |  2008-09-09  |  5KB  |  156 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.  Author: Bj├╕rn Lindeijer <bjorn@lindeijer.nl>
  5.  Copyright (C) 2004 Bj├╕rn Lindeijer <bjorn@lindeijer.nl>
  6.  
  7.  This library is free software; you can redistribute it and/or modify
  8.  it under the terms of the GNU General Public License as published by
  9.  the Free Software Foundation; either version 2 of the License, or
  10.  (at your option) any later version.
  11.  
  12.  This program is distributed in the hope that it will be useful,
  13.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  GNU General Public License for more details.
  16.  
  17.  You should have received a copy of the GNU General Public License
  18.  along with this program; if not, write to the Free Software
  19.  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  20.  
  21. -->
  22. <language id="lua" _name="Lua" version="2.0" _section="Scripts">
  23.   <metadata>
  24.     <property name="mimetypes">text/x-lua</property>
  25.     <property name="globs">*.lua</property>
  26.     <property name="line-comment-start">--</property>
  27.     <property name="block-comment-start">--[[</property>
  28.     <property name="block-comment-end">]]</property>
  29.   </metadata>
  30.  
  31.   <styles>
  32.     <style id="comment" _name="Comment" map-to="def:comment"/>
  33.     <style id="string" _name="String" map-to="def:string"/>
  34.     <style id="keyword" _name="Keyword" map-to="def:keyword"/>
  35.     <style id="escape" _name="Escaped Character" map-to="def:special-char"/>
  36.     <style id="reserved" _name="Reserved Identifier" map-to="def:keyword"/>
  37.     <style id="function" _name="Function" map-to="def:function"/>
  38.     <style id="nil-value" _name="Nil Constant" map-to="def:special-constant"/>
  39.     <style id="boolean" _name="Boolean value" map-to="def:boolean"/>
  40.   </styles>
  41.  
  42.   <definitions>
  43.     <context id="lua-escape" style-ref="escape">
  44.       <match>\\(\d\d?\d?|.)</match>
  45.     </context>
  46.  
  47.     <context id="string" style-ref="string" end-at-line-end="true">
  48.       <start>["']</start>
  49.       <end>\%{0@start}</end>
  50.       <include>
  51.         <context ref="lua-escape"/>
  52.         <context ref="def:line-continue"/>
  53.       </include>
  54.     </context>
  55.  
  56.     <context id="multi-line-string" style-ref="string">
  57.       <start>\[(=*)\[</start>
  58.       <end>]\%{1@start}]</end>
  59.     </context>
  60.  
  61.     <context id="block-comment" style-ref="comment">
  62.       <start>--\[(=*)\[</start>
  63.       <end>]\%{1@start}]</end>
  64.       <include>
  65.     <context ref="def:in-comment"/>
  66.       </include>
  67.     </context>
  68.  
  69.     <context id="line-comment" style-ref="comment" end-at-line-end="true">
  70.       <start>--</start>
  71.       <include>
  72.     <context ref="def:in-comment"/>
  73.       </include>
  74.     </context>
  75.  
  76.     <context id="keywords" style-ref="keyword">
  77.       <keyword>and</keyword>
  78.       <keyword>break</keyword>
  79.       <keyword>do</keyword>
  80.       <keyword>else</keyword>
  81.       <keyword>elseif</keyword>
  82.       <keyword>end</keyword>
  83.       <keyword>for</keyword>
  84.       <keyword>function</keyword>
  85.       <keyword>if</keyword>
  86.       <keyword>in</keyword>
  87.       <keyword>local</keyword>
  88.       <keyword>not</keyword>
  89.       <keyword>or</keyword>
  90.       <keyword>repeat</keyword>
  91.       <keyword>return</keyword>
  92.       <keyword>then</keyword>
  93.       <keyword>until</keyword>
  94.       <keyword>while</keyword>
  95.     </context>
  96.  
  97.     <context id="functions" style-ref="function">
  98.       <keyword>assert</keyword>
  99.       <keyword>collectgarbage</keyword>
  100.       <keyword>dofile</keyword>
  101.       <keyword>error</keyword>
  102.       <keyword>getfenv</keyword>
  103.       <keyword>getmetatable</keyword>
  104.       <keyword>gcinfo</keyword>
  105.       <keyword>ipairs</keyword>
  106.       <keyword>loadfile</keyword>
  107.       <keyword>loadlib</keyword>
  108.       <keyword>loadstring</keyword>
  109.       <keyword>next</keyword>
  110.       <keyword>pairs</keyword>
  111.       <keyword>pcall</keyword>
  112.       <keyword>print</keyword>
  113.       <keyword>rawequal</keyword>
  114.       <keyword>rawget</keyword>
  115.       <keyword>rawset</keyword>
  116.       <keyword>require</keyword>
  117.       <keyword>setfenv</keyword>
  118.       <keyword>setmetatable</keyword>
  119.       <keyword>tonumber</keyword>
  120.       <keyword>tostring</keyword>
  121.       <keyword>type</keyword>
  122.       <keyword>unpack</keyword>
  123.       <keyword>xpcall</keyword>
  124.     </context>
  125.  
  126.     <context id="lua-reserved" style-ref="reserved">
  127.       <keyword>_[A-Z][A-Za-z0-9_]*</keyword>
  128.     </context>
  129.  
  130.     <context id="nil-value" style-ref="nil-value">
  131.        <keyword>nil</keyword>
  132.     </context>
  133.  
  134.     <context id="boolean" style-ref="boolean">
  135.        <keyword>false</keyword>
  136.        <keyword>true</keyword>
  137.     </context>
  138.  
  139.     <context id="lua">
  140.       <include>
  141.         <context ref="def:shebang"/>
  142.         <context ref="multi-line-string"/>
  143.         <context ref="string"/>
  144.         <context ref="block-comment"/>
  145.         <context ref="line-comment"/>
  146.         <context ref="keywords"/>
  147.     <context ref="functions"/>
  148.     <context ref="lua-reserved"/>
  149.         <context ref="nil-value"/>
  150.         <context ref="boolean"/>
  151.       </include>
  152.     </context>
  153.  
  154.   </definitions>
  155. </language>
  156.